#include <QtGui/QApplication>
#include "toolkit.h"
#ifdef Q_OS_SYMBIAN
#include <eikenv.h>
#include <coemain.h>
#include <aknappui.h>

#include <aknswallpaperutils.h>
#endif //Q_OS_SYMBIAN
#include <QTextCodec>
#include "mainwindow.h"
#include <QImage>
#include "browseview.h"

QString ToolKit::m_path = "";
MainWindow* ToolKit::m_mainWindow = NULL;
QImage* ToolKit::m_cameraImage = NULL;
EFFECTTP ToolKit::m_effectTp = OLD_TYPE;
QString ToolKit::m_strSelImage = "";
BrowseView* ToolKit::m_browseView = NULL;
int ToolKit::m_icurIndex = 0;
int ToolKit::m_iThreadType = 0;
int ToolKit::m_language = 31;

ToolKit::ToolKit()
{
}

void ToolKit::SetOrientation(bool bLandscape)
{
#ifdef Q_OS_SYMBIAN
    CAknAppUi *aknAppUi = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
    if (aknAppUi)
    {
        if(bLandscape)
            aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
        else
            aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
    }
#endif //Q_OS_SYMBIAN
}

void ToolKit::SetGBKText()
{
    QTextCodec *codec = QTextCodec::codecForName("GBK");
    QTextCodec::setCodecForLocale(codec);
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForTr(codec);
}

void ToolKit::SetWallPaper(const QString strfile)
{
//    TPtrC16 textPtr(reinterpret_cast<const TUint16*>(strfile.utf16()),strfile.length());
//    AknsWallpaperUtils::SetIdleWallpaper(textPtr, CCoeEnv::Static());
}
